package HLCustomFarm;

import HLCustom.HLIInstructionType_H;
import HLLib.base.HLImage;
import HLLib.base.HLList;
import HLLib.base.HLMath;
import HLLib.base.HLString;
import HLLib.json.HLJSONObject;

public class HLFarmData implements HLIInstructionType_H, HLFarm_H {
    //
    public HLString name;

    public int level;

    public int levelExp;

    public int uplevelExp;

    public int money;

    public int FBMoney;

    public int castMoney;

    public int castFBMoney;

    public HLList lands;

    public HLImage head;

    public int uid;

    public boolean isUseDog;

    public int dogId;

    public int timeLimitDF;

    public HLFarmData() {
        name = new HLString();
        lands = new HLList();
    }

    /**
     * "uId":"60","level":"11","money":"986823","experience":"13301","levelExp":
     * "101","FBMoney":"8266",
     * "haveDog":"1","timeLimitDF":"1301194883","uplevelExp":"2400"}
     * 
     * @param jo
     */
    public void GetData(HLJSONObject jo) {
        HLString sParm = new HLString();
        sParm.SetString("user");
        HLJSONObject joUser = jo.getJSONObject(sParm);
        if (joUser == null) {

            return;
        }
        sParm.SetString("level");
        level = joUser.getInt(sParm);

        sParm.SetString("uId");
        uid = joUser.getInt(sParm);

        sParm.SetString("money");
        money = joUser.getInt(sParm);

        sParm.SetString("levelExp");
        levelExp = joUser.getInt(sParm);

        sParm.SetString("uplevelExp");
        uplevelExp = joUser.getInt(sParm);

        sParm.SetString("FBMoney");
        FBMoney = joUser.getInt(sParm);

        sParm.SetString("haveDog");
        int haveDog = joUser.getInt(sParm);
        isUseDog = HLMath.IsEqual(haveDog, 1);

        sParm.SetString("timeLimitDF");
        timeLimitDF = joUser.getInt(sParm);

        sParm.SetString("dogId");
        dogId = joUser.getInt(sParm);

    }

}
